package net.kosev.battleships;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

/**
 * Menu Activity
 * 
 * @author Nikola
 *
 */
public class MenuScreen extends Activity implements OnClickListener {
	
	/**
	 * Play button component
	 */
	private Button mPlay = null;
	
	/**
	 * Settings button component
	 */
	private Button mSettings = null;
	
	/**
	 * Quit button component
	 */
	private Button mQuit = null;

	/*
	 * (non-Javadoc)
	 * @see android.app.Activity#onCreate(android.os.Bundle)
	 */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.menu);
        
        mPlay = (Button) findViewById(R.id.ButtonPlay);
        mPlay.setOnClickListener(this);
        
        mSettings = (Button) findViewById(R.id.ButtonSettings);
        mSettings.setOnClickListener(this);
        
        mQuit = (Button) findViewById(R.id.ButtonQuit);
        mQuit.setOnClickListener(this);
        
        // load preferences
        Config.load(this);
    }

    /*
     * (non-Javadoc)
     * @see android.view.View.OnClickListener#onClick(android.view.View)
     */
	public void onClick(View button) {
		switch (button.getId()) {
		case R.id.ButtonPlay:
			Intent intent = new Intent(this, GameScreen.class);
			startActivity(intent);
			break;
		case R.id.ButtonSettings:
			Intent intent2 = new Intent(this, SettingsScreen.class);
			startActivity(intent2);
			break;
		case R.id.ButtonQuit:
			//Intent intent3 = new Intent(this, ResultScreen.class);
			//startActivity(intent3);
			finish();
			break;
		}
	}
    
}